//
//  DHDiagnosisTypeViewController.m
//  DHKuaiYi
//
//  Created by  chenhanmao on 2016/11/14.
//  Copyright © 2016年 30-陈辉华. All rights reserved.
//

#import "DHDiagnosisTypeViewController.h"
#import "DHDiagnosisTypeCell.h"

@interface DHDiagnosisTypeViewController ()<UITableViewDataSource,UITableViewDelegate>

/**  数据源数组  */
@property(nonatomic,strong) NSArray *diafnosisTypes;

@end

@implementation DHDiagnosisTypeViewController


#pragma mark - dataSource方法的实现

//  返回行数
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.diafnosisTypes.count;
}

//  返回cell
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    DHDiagnosisTypeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    
    if (cell == nil) {
        cell = [[DHDiagnosisTypeCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    
    cell.textLabel.text = self.diafnosisTypes[indexPath.row];
    
    return cell;
}

#pragma mark - UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    //回调治疗方式
    self.diagnosisTypeBlock(self.diafnosisTypes[indexPath.row]);
    
    [self.navigationController popViewControllerAnimated:YES];
}



#pragma mark - 设置导航栏
- (void)xhhSetupNavigationItems {
    
    self.title = @"选择治疗方式";
}


- (void)xhhSetupSubviews {
    
    UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
    
    [self.view addSubview:tableView];
    
    tableView.dataSource = self;
    tableView.delegate = self;
    
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    tableView.backgroundColor = [UIColor XHH_colorWithHex: 0xefeff4];
    
}



- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.diafnosisTypes = @[@"手术治疗",@"保守治疗",@"药物治疗"];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
